<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head>
  <meta charset=utf-8"UTF-8">
  <meta name="renderer" content="webkit">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" th:href="@{/static/css/layui.css}">
  <title>pdf预览</title>
</head>
<body>
<div class="card" style="width: 85vw;left: 7.5vw;top: 5vh" sec:authorize="!isAuthenticated()">
  <div class="card-body">
    <h5 class="card-title">未登录</h5>
    <p class="card-text">您还没有登录,请先登录</p>
    <a href="#" class="btn btn-primary" th:href="@{/login}">登录</a>
  </div>
</div>

<h1 onclick="onLineReadPDF()" style="cursor: pointer;color:blue" sec:authorize="isAuthenticated()">在线阅读PDF文件</h1>

<script>
  function onLineReadPDF() {
    layer.open({
      type: 2
      ,title: 'pdf预览' //不显示标题栏
      ,closeBtn: false
      ,area: ['90%','90%']
      // ,shade: 0.8
      // ,id: 'LAY_layuipro' //设定一个id，防止重复弹出
      ,btn: ['继续', '关闭']
      ,btnAlign: 'c'
      ,moveType: 1 //拖拽模式，0或者1
      ,moveOut: true
      ,closeBtn:1
      ,content: 'http://localhost:9123/static/plugins/pdfjs/web/viewer.html?file=http://localhost:9123/score/preview'
      ,success: function(layero){
        //点击按钮 do something
      }
    });
  }
</script>
<script src="/static/js/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="/static/layui.js"></script>
</body>
</html>